home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
dvtools
/
demos
/
telecomdemo
/
dialog.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-08
|
5KB
|
148 lines
#ifndef lint
static char SccsId[]= "@(#)dialog.c V1.7 3/17/95";
#endif
/*
| File name: dialog.c
|========================================================================
|
| Copyright (c) 1990 -- V.I. Corporation
|
|========================================================================
*/
#include "simulate.h"
#include "tlc_fundecl.h"
/*
* LoadDialogView -- load the dialog view, get the interesting objects and
* create a drawport.
*/
void
LoadDialogView (viewname)
char *viewname;
{
OBJECT drawing;
OBJECT drawing_limit, point;
DV_POINT dummy;
Dialog.disp_info.view = TviLoad (viewname);
drawing = TviGetDrawing (Dialog.disp_info.view);
Dialog.failure_str = TdrGetNamedObject (drawing, "NumFailures");
Dialog.critical_str = TdrGetNamedObject (drawing, "NumCriticals");
Dialog.softerror_str = TdrGetNamedObject (drawing, "NumSoftErrors");
Dialog.node_name_str = TdrGetNamedObject (drawing, "NodeName");
/*
* Get the object that defines the part of the drawing to be displayed
* and use to clip the drawing and set its position on the screen.
*/
drawing_limit = TdrGetNamedObject (drawing, "DrawingLimit");
point = VOobPtGet (drawing_limit, 1);
VOptGet (point, &Dialog.disp_info.drawing_area.ll, &dummy);
point = VOobPtGet (drawing_limit, 2);
VOptGet (point, &Dialog.disp_info.drawing_area.ur, &dummy);
Dialog.disp_info.virt_pos.ll.x = Dialog.disp_info.drawing_area.ll.x + 16383;
Dialog.disp_info.virt_pos.ll.y = Dialog.disp_info.drawing_area.ll.y + 16383;
Dialog.disp_info.virt_pos.ur.x = Dialog.disp_info.drawing_area.ur.x + 16383;
Dialog.disp_info.virt_pos.ur.y = Dialog.disp_info.drawing_area.ur.y + 16383;
(VOID) GRvcs_to_scs (&Dialog.disp_info.virt_pos.ll,
&Dialog.disp_info.screen_pos.ll);
(VOID) GRvcs_to_scs (&Dialog.disp_info.virt_pos.ur,
&Dialog.disp_info.screen_pos.ur);
Dialog.disp_info.drawport = TdpCreateStretch (StatusScreen,
Dialog.disp_info.view,
&Dialog.disp_info.virt_pos,
&Dialog.disp_info.drawing_area);
/*
* Initialize the information in the dialog structure.
*/
Dialog.disp_info.drawn = NO;
Dialog.disp_info.active = NO;
Dialog.node_ptr = NULL;
Dialog.next_view = NULL;
}
/*
* UpdateDialogDrawport -- update the error counters that are represented
* by vector text objects.
*/
void UpdateDialogDrawport
V_P_ ((void))
{
(VOID) TdpEraseObject (Dialog.disp_info.drawport, Dialog.failure_str);
SetNumberString (Dialog.failure_str, Dialog.node_ptr->failure_count);
(VOID) TdpDrawObject (Dialog.disp_info.drawport, Dialog.failure_str);
(VOID) TdpEraseObject (Dialog.disp_info.drawport, Dialog.critical_str);
SetNumberString (Dialog.critical_str, Dialog.node_ptr->critical_count);
(VOID) TdpDrawObject (Dialog.disp_info.drawport, Dialog.critical_str);
(VOID) TdpEraseObject (Dialog.disp_info.drawport, Dialog.softerror_str);
SetNumberString (Dialog.softerror_str, Dialog.node_ptr->softerror_count);
(VOID) TdpDrawObject (Dialog.disp_info.drawport, Dialog.softerror_str);
}
/*
* PickInDialogDrawport -- process picks in the dialog drawport. The
* only actions we're looking for is to go to a subview and to erase
* the dialog drawport.
*/
void
PickInDialogDrawport (location)
OBJECT location;
{
CHAR *name;
(VOID) VUerHandleLocEvent (location);
if ((name = TloGetSelectedObjectName (location)))
{
if (strcmp (name, "Detail") == 0)
if (Dialog.next_view)
NewMainView (SimParams.curr_view, Dialog.next_view);
if (strcmp (name, "Quit") == 0)
EraseSubView (&Dialog.disp_info, (RECTANGLE *) NULL);
}
}
/*
* SetupDialogBox -- setup the objects in the dialog box using the
* information from the node structure.
*/
void
SetupDialogBox (node_struct, next_view)
NODE_STRUCT *node_struct;
VIEW_STRUCT *next_view;
{
VOvtSetString (Dialog.node_name_str, node_struct->node_name);
SetNumberString (Dialog.failure_str, node_struct->failure_count);
SetNumberString (Dialog.critical_str, node_struct->critical_count);
SetNumberString (Dialog.softerror_str, node_struct->softerror_count);
Dialog.next_view = next_view;
Dialog.node_ptr = node_struct;
}
/*
* MoveDialogDrawport -- move the dialog drawport. Save the original
* position, allow the user to move it, and then repair the screen.
*/
void
MoveDialogDrawport (location)
OBJECT location;
{
RECTANGLE old_pos;
old_pos.ll.x = Dialog.disp_info.screen_pos.ll.x;
old_pos.ll.y = Dialog.disp_info.screen_pos.ll.y;
old_pos.ur.x = Dialog.disp_info.screen_pos.ur.x;
old_pos.ur.y = Dialog.disp_info.screen_pos.ur.y;
MoveDrawport (StatusScreen, &Dialog.disp_info.screen_pos, location);
NewPosition (&Dialog.disp_info, &old_pos);
}